package com.spic.business.informatization.before_after_work.controller;

import com.spic.business.informatization.before_after_work.domain.MeetingBeforWorkSearchRecord;
import com.spic.business.informatization.before_after_work.service.MeetingBeforWorkSearchRecordService;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *班前会会议地点搜索记录框Controller
 *
 * @author yangjie
 * @date 2021-11-24
 */
@RestController
@RequestMapping("/informatization/search_record")
public class MeetingBeforWorkSearchRecordController extends BaseController
{
    @Autowired
    private MeetingBeforWorkSearchRecordService meetingBeforWorkSearchRecordService;

    /**
     * 查询班前班后会会议地点搜索记录框列表
     */
    @GetMapping("/list")
    public AjaxResult list(MeetingBeforWorkSearchRecord meetingBeforWorkSearchRecord)
    {
        List<MeetingBeforWorkSearchRecord> list = meetingBeforWorkSearchRecordService.selectMeetingBeforWorkSearchRecordList(meetingBeforWorkSearchRecord);

        return AjaxResult.success(list);
    }
    @GetMapping("/bySearch/{deptId}")
    public AjaxResult selectMeetingBeforWorkSearchRecordMap(@PathVariable("deptId") Long deptId)
    {
        return AjaxResult.success(meetingBeforWorkSearchRecordService.selectMeetingBeforWorkSearchRecordMap(deptId));
    }
    /**
     * 获取班前班后会会议地点搜索记录框详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(meetingBeforWorkSearchRecordService.selectMeetingBeforWorkSearchRecordById(id));
    }

    /**
     * 新增班前班后会会议地点搜索记录框
     */
    @PostMapping
    public AjaxResult add(@RequestBody MeetingBeforWorkSearchRecord meetingBeforWorkSearchRecord)
    {
        return toAjax(meetingBeforWorkSearchRecordService.insertMeetingBeforWorkSearchRecord(meetingBeforWorkSearchRecord));
    }

    /**
     * 修改班前班后会会议地点搜索记录框
     */
    @PutMapping
    public AjaxResult edit(@RequestBody MeetingBeforWorkSearchRecord meetingBeforWorkSearchRecord)
    {
        return toAjax(meetingBeforWorkSearchRecordService.updateMeetingBeforWorkSearchRecord(meetingBeforWorkSearchRecord));
    }

    /**
     * 删除班前班后会会议地点搜索记录框
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(meetingBeforWorkSearchRecordService.deleteMeetingBeforWorkSearchRecordByIds(ids));
    }


}
